
#include "pwm.h"

void pwm_set_freq(unsigned int speed)
{
    if (speed > PULSE_MAX)
        speed = PULSE_MAX;

    TIM4_cnt = (speed == 0) ? (int)(TIM_CLK / 2) : (int)(1000000U / speed / 2.0);
}
